package com.jyxd.web.service.dictionary;

import com.jyxd.web.dao.basic.RespiratorDictonaryDao;
import com.jyxd.web.data.dictionary.RespiratorDictonary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *呼吸机字典设置service
 */

@Service
@Transactional
public class RespiratorDictonaryService {

    @Autowired
    private RespiratorDictonaryDao respiratorDictonaryDao;

    public boolean insert(RespiratorDictonary respiratorDictonary){
        return respiratorDictonaryDao.insert(respiratorDictonary);
    }

    public boolean update(RespiratorDictonary respiratorDictonary){
        return respiratorDictonaryDao.update(respiratorDictonary);
    }

    public RespiratorDictonary queryData(String id){
        return respiratorDictonaryDao.queryData(id);
    }

    public List<RespiratorDictonary> queryList(Map<String,Object> map){
        return respiratorDictonaryDao.queryList(map);
    }

    public int queryNum(Map<String,Object> map){return respiratorDictonaryDao.queryNum(map);}

    /**
     * 清空床位信息
     * @param bedCode
     */
    public boolean cleanByBedCode(String bedCode) {
        return respiratorDictonaryDao.cleanByBedCode(bedCode);
    }

    public boolean updateByRespitatorNumbers(String bedCode, String respiratorNumbers) {
        Map<String,Object> map=new HashMap<String,Object>();
        map.put("bedCode",bedCode);
        map.put("respiratorNumbers",respiratorNumbers);
        return respiratorDictonaryDao.updateByRespitatorNumbers(map);
    }

    /**
     * 查询绑定盒子的呼吸机
     * @return
     */
    public List<Map<String, Object>> queryBindBoxList() {
        return respiratorDictonaryDao.queryBindBoxList();
    }

    public int deleteById(String id) {
        return respiratorDictonaryDao.deleteById(id);
    }
}
